package net.stogi.unicore.beyond.api.dto;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import net.stogi.unicore.beyond.api.model.InputDefinition;
import net.stogi.unicore.beyond.api.model.InputGroup;
import net.stogi.unicore.beyond.api.model.TaskDefinition;

public class TaskInstance implements Serializable {

	private static final long serialVersionUID = 5336036701287098231L;

	private Map<String, String> inputs;

	private TaskDefinition taskDefinition;

	public TaskInstance() {
		inputs = new HashMap<String, String>();
	}

	public TaskInstance(TaskDefinition taskDefinition) {
		this();
		this.taskDefinition = taskDefinition;
		for (InputGroup inputGroup : taskDefinition.getInputGroups()) {
			for (InputDefinition inputDefinition : inputGroup.getInputDefinitions()) {
				inputs.put(inputDefinition.getName(), null);
			}
		}
	}

	public String getInput(String name) {
		return inputs.get(name);
	}

	public Map<String, String> getInputs() {
		return inputs;
	}

	public TaskDefinition getTaskDefinition() {
		return taskDefinition;
	}

	public void setInputs(Map<String, String> inputs) {
		this.inputs = inputs;
	}
	
	public void setTaskDefinition(TaskDefinition taskDefinition) {
		this.taskDefinition = taskDefinition;
	}
}
